Skip to content

Conversation

@longwave
Copy link
Contributor

@longwave longwave commented Feb 2, 2026

Reasoning for this change is in JetBrains/phpstorm-stubs#1793 - I think this is the correct change to make on the PHPStan side.

Helps #4845 and in turn phpstan/phpstan#14041

'mb_scrub' => ['hasSideEffects' => false],
'mb_split' => ['hasSideEffects' => false],
'mb_str_pad' => ['hasSideEffects' => false],
'mb_str_pad' => ['hasSideEffects' => true],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What side effect does this function have?

Copy link
Contributor Author

@longwave longwave Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 mb_str_pad(
    string $string,
    int $length,
    string $pad_string = " ",
    int $pad_type = STR_PAD_RIGHT,
    ?string $encoding = null
): string

If $encoding is null then the internal encoding is used, which can be changed by mb_internal_encoding(). This is not a side effect but means it's not entirely a pure function?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, good enough :) Thank you.

@ondrejmirtes ondrejmirtes merged commit 10c7083 into phpstan:2.1.x Feb 2, 2026
635 of 640 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants